
/**
 * @param {*} category 课程分类接口
 * @param {*} card 视频卡片接口
 * @param {*} query_by_cid 分类查询接口
 * @param {*} detail 课程详情接口
 * @param {*} chapter 课程章集接口
 * @param {*} material_by_id 课程资料接口
 * @param {*} page 用户评论列表
 */
const ProductService = require('../service/ProductService')

const ProductController = {
    category: async(req, res) => {
        let handleRes = await ProductService.category()
        res.send(handleRes)
    },
    card: async(req, res) => {
        let handleRes = await ProductService.card()
        res.send(handleRes)
    },
    query_by_cid: async(req, res) => {
        const { cid, page, size, cpid } = req.body
        let handleRes = await ProductService.query_by_cid(cid, page, size, cpid)
        res.send(handleRes)
    },
    detail:async (req,res) => {
        const {id} = req.query
        let handleRes = await ProductService.detail(id)
        res.send(handleRes)
    },
    chapter:async(req, res) => {
        const {id} = req.query
        let handleRes = await ProductService.chapter(id)
        res.send(handleRes)
    },
    material_by_id:async (req, res) => {
        let handleRes = await ProductService.material_by_id(req)
        res.send(handleRes)
    },
    page:async(req, res) => {
        let handleRes = await ProductService.page(req)
        res.send(handleRes)
    }
}
module.exports = ProductController